package com.puyuba.puyuba.view.adapter;

import android.content.Context;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseViewHolder;
import com.puyuba.puyuba.R;
import com.pyb.java.basemodule.BaseAdapter;
import com.puyuba.puyuba.bean.TextselectBean;

import java.util.List;

public class ChooseAdatper extends BaseAdapter<TextselectBean> {
    private final Context context;

    public ChooseAdatper(Context context, @Nullable List data) {
        super(context, R.layout.item_recycleview_choose, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, TextselectBean item) {

        helper.addOnClickListener(R.id.btn_choose);
        helper.setText(R.id.btn_choose,item.getName());

        boolean select = item.isSelect();
        if (select){
            helper.setBackgroundRes(R.id.btn_choose,R.drawable.bg_text_select);
            helper.setTextColor(R.id.btn_choose,context.getColor(R.color.black));
        }else {
            helper.setBackgroundRes(R.id.btn_choose,0);
            helper.setTextColor(R.id.btn_choose,context.getColor(R.color.color_4e4e4e));
        }
    }

}
